<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>审核项目</title>
    <script src="/js/jquery.js"></script>
    <link rel="stylesheet" href="/admin/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="/admin/css/dashboard.css"/>
    <script src="/admin/js/bootstrap.min.js"></script>
    <script src="/admin/js/countUp.js"></script>
    <script>
        $(document).ready(function () {
            $(".delete").click(function () {
                alert(11111)
                var tt = $(this).parent().siblings()
                var tno = $(tt[0]).text();
                alert(tno)
                window.location.href = "/projectManagement/deleteOneType?tno=" + tno;
            })


            $(".commit").click(function () {
                alert(11111)
                var tno = $('input[name=tno]').val();
                var tname = $('input[name=tname]').val();
                var tdescribe = $('input[name=tdescribe]').val();
                var ttime = $('input[name=ttime]').val();
                var tstatus = $('input[name=tstatus]').val();
                window.location.href = "/projectManagement/updateOneType?tno=" + tno + "&tname=" + tname + "&tdescribe=" + tdescribe + "&ttime=" + ttime + "&tstatus=" + tstatus;
            })

            $(".committ").click(function () {
                alert(11111)
                var tname = $('input[name=tnamee]').val();
                var tdescribe = $('input[name=tdescribee]').val();
                var nowDate = new Date();
                var year = nowDate.getFullYear();
                var month = nowDate.getMonth() + 1 < 10 ? "0" + (nowDate.getMonth() + 1): nowDate.getMonth() + 1;
                var day = nowDate.getDate() < 10 ? "0" + nowDate.getDate() : nowDate.getDate();
                var ttime =year + "-" + month + "-" + day;
                var tstatus = $('input[name=tstatuss]').val();
                alert(ttime)
                window.location.href = "/projectManagement/addOneType?tname=" + tname + "&tdescribe=" + tdescribe + "&ttime=" + ttime + "&tstatus=" + tstatus;
            })


        });

        function update(obj) {/*点击修改按钮，给模态框加载信息并且弹出模态框*/
            var tds = $(obj).parent().parent().find('td');
            $("#roomType").val(tds.eq(0).text());
            $("#bedNumber").val(tds.eq(1).text());
            $("#roomPrice").val(tds.eq(2).text());
            $("#discountPrice").val(tds.eq(3).text());
            $("#hourPrice").val(tds.eq(4).text());
            $('#updatModal').modal({show: true})
        }

        function add(obj) {/*点击修改按钮，给模态框加载信息并且弹出模态框*/


            $('#addModal').modal({show: true})
        }


    </script>
</head>
<body>


<div class="modal fade" id="updatModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"
                        aria-hidden="true">×
                </button>
                <h4 class="modal-title" id="myModalLabel"
                    style="color: black; text-align: left; font-size: 18px;">
                    修改房间类型信息：</h4>
            </div>
            <form action="" method="post">
                <div class="modal-body" style="color: black;">
                    序号：<input class="upRoom" id="roomType" type="text" value="" readonly="true" name="tno"/><br/><br/>
                    名称：<input class="upRoom" id="bedNumber" type="text" value="" readonly="true"
                              name="tname"/><br/><br/>
                    描述：<input class="upRoom" id="roomPrice" type="text" value="" name="tdescribe"/><br/><br/>
                    时间：<input class="upRoom" id="discountPrice" type="text" value="" name="ttime"/><br/><br/>
                    状态：<input class="upRoom" id="hourPrice" type="text" value="" name="tstatus"/><br/>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="submit" class="commit">提交更改</button>
                </div>
            </form>
        </div>

        <!-- /.modal-content -->
    </div>
    <!-- /.modal -->​​
</div>

<%--新增的模态框--%>
<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"
                        aria-hidden="true">×
                </button>
                <h4 class="modal-title" id="myModalLabell"
                    style="color: black; text-align: left; font-size: 18px;">
                    修改房间类型信息：</h4>
            </div>
            <form action="" method="post">
                <div class="modal-body" style="color: black;">
                    名称：<input class="upRoom" id="bedNumberr" type="text" value="" name="tnamee"/><br/><br/>
                    描述：<input class="upRoom" id="roomPricee" type="text" value="" name="tdescribee"/><br/><br/>
                    状态：<input class="upRoom" id="hourPricee" type="text" value="" name="tstatuss"/><br/>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="submit" class="committ">提交更改</button>
                </div>
            </form>
        </div>

        <!-- /.modal-content -->
    </div>
    <!-- /.modal -->​​
</div>


<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
                    aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">众筹管理平台</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">

            <ul class="nav navbar-nav navbar-right">
                <li><a href="../index.jsp">首页</a></li>
                <li><a href="#">欢迎,${manage.mname}</a></li>
                <li><a href="#" title="修改个人资料和密码的页面">设置</a></li>
                <li><a href="#" title="退出登录">退出</a></li>
            </ul>
        </div>
    </div>
</nav>

<div class="container-fluid">
    <div class="row">
        <div class="col-sm-3 col-md-2 sidebar">
            <ul class="nav nav-sidebar">
                <li ><a href="/admin/index.jsp">首页</a></li>
            </ul>
            <ul class="nav nav-sidebar">
                <li><a href="/projectManagement/getAll">所有项目*</a></li>
                <li><a href="/projectManagement/getAllNoPro">项目审核</a></li>

                <li><a href="/projectManagement/getAllComment">项目评论</a></li>
                <li class="active"><a href="/projectManagement/getAllType">项目分类*</a></li>

            </ul>
            <ul class="nav nav-sidebar">
                <li><a href="/admin/getUsersByCon">注册用户</a></li>
                <li><a href="/admin/getUsersMoney">用户资金</a></li>
                <li><a href="/admin/getUsersReal">实名审核</a></li>
            </ul>
            <ul class="nav nav-sidebar">
                <li><a href="/admin/getNews">新闻管理</a></li>
                <li><a href="/admin/getQuestion">问题管理</a></li>
                <li><a href="/admin/admin_manage.jsp">管理用户</a></li>
                <%--<li><a href="">管理日志</a></li>--%>
            </ul>
        </div>


        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
            <h1 class="page-header">所有类别</h1>

            <ul class="nav nav-tabs">
                <li role="presentation" class="active"><a href="product-info1.jsp">基本信息</a></li>
            </ul>
            <div>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title">项目信息</h3>
                    </div>
                    <div class="panel-body">
                        <table class="table table-bordered">

                            <thead>
                            <tr>
                                <th>序号</th>
                                <th>各类名称</th>
                                <th>种类描述</th>
                                <th>时间</th>
                                <th>分类状态</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>

                            <c:forEach items="${types}" var="t">
                                <tr>
                                    <td>${t.tno}</td>
                                    <td>${t.tname}</td>
                                    <td>${t.tdescribe}</td>
                                    <td>${t.ttime}</td>
                                    <td>${t.tstatus}</td>
                                    <td>
                                        <span class="update" onclick="update(this)">修改</span>
                                        <span class="delete">删除</span>

                                        <!--< a href="#" title="查看项目详情"><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span></ a>-->
                                        <!--&nbsp;&nbsp;
                                        < a href="#" title="编辑项目信息"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></ a>-->
                                    </td>
                                </tr>
                            </c:forEach>
                            </tbody>
                            <span class="add" onclick="add(this)"><button>新增项目</button></span>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


</body>
</html>
